package com.buaa.dao.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.buaa.dao.BaseDao;
import com.buaa.utils.HibernateUtil;

@Repository
@SuppressWarnings("unchecked")
public class BaseDaoImpl implements BaseDao {

	@Autowired
	private HibernateUtil hibernateUtil;

	@Override
	public List<Object> common1(String sql) {
		return hibernateUtil.findAllBySQL(sql, null);
	}

	@Override
	public List<Object[]> common2(String sql) {
		return sql == null ? null : hibernateUtil.findAllBySQL(sql, null);
	}

	@Override
	public List<Object> findBaseLevel() {
		return hibernateUtil.findAllBySQL("SELECT DISTINCT level FROM base", null);
	}

	@Override
	public List<Object> findBaseType() {
		return hibernateUtil.findAllBySQL("SELECT DISTINCT type FROM base", null);
	}

}
